Passed
Push — master ( 139be6...b9ad79 )
by
unknown
09:22
created

graph.helpers.ts ➔ waitForAllTransitions   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
import { ElementHandle } from 'puppeteer';
2
import { TRANSITION_DURATION } from '../../src/utils/AppConsts';
3
4
export async function waitForGraphStabilization() {
5
    await page.waitFor(500);
6
}
7
8
export async function waitForAllTransitions() {
9
    await page.waitFor(TRANSITION_DURATION);
10
}
11
12
// Replacement of element.boundingBox() - we need to get node positions within SVG container, not relative to main frame
13
export async function getElementBBox(element: ElementHandle<SVGGraphicsElement>) {
14
    return await element.evaluate(el => {
15
        const { x, y, width, height } = el.getBBox();
16
        return { x, y, width, height };
17
    });
18
}
19